<template>
    <div :style="videoType ? styleBlack : ''">
        <div class="main-con" :style="videoType ? styleBlack : ''">
            <div v-if="!videoType" class="article">
                <div class="all">
                    <div class="bookImg">
                        <img :src="info.thumb" alt="">
                    </div>
                    <div class="top" :style="{ borderColor: videoType ? '#fff' : '' }">
                        <p class="title" :style="videoType ? styleBlack2 : ''">
                            {{ info.title }}
                        </p>
                        <div class="author" :style="videoType ? styleBlack2 : ''">
                            <span v-if="info.author">作者 / {{ info.author }}</span>
                            <span v-if="info.owner">主委 / {{ info.owner }}</span>
                        </div>
                        <div class="other" v-if="info.helper.length != 0">
                            <span>执行主委/</span>
                            <div class="price" v-for="(item, index) in info.helper" :key="index">
                                <span>{{ item.user_nickname }}</span>
                            </div>
                        </div>
                        <div class="tron">
                            {{ info.intro }}
                        </div>
                    </div>
                    <div class="vhtml" ref="htmlContainers">
                        <!-- 渲染富文本 -->
                        <div class="richText" ref="htmlContainer" v-html="info.content" @mouseup="handleMouseUp"></div>
                        <!-- 自定义菜单 -->
                        <div v-if="showMenu" :style="menuStyle" class="custom-menu">
                            <button @click="getSelectedText('zc')">摘抄</button>
                            <button @click="getSelectedText('pl')">评论</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="media" v-if="videoType">
                <p>{{ cinfo.title }}</p>
                <video controls width="600" autoplay>
                    <source :src="videoSrc" type="video/mp4" />
                    您的浏览器不支持 video 标签。
                </video>
                <div class="setList">>

                </div>
            </div>
            <!-- 右侧 -->
            <div v-if="!$store.getters.isMobile" class="tabList" :style="videoType ? styleBlack : ''">
                <div class="top" :style="videoType ? styleBlack2 : ''">
                    <p class="title" :style="videoType ? styleBlack2 : ''">
                        {{ info.name }}
                    </p>

                    <div class="other">
                        <div class="price" :style="videoType ? styleBlack2 : ''">
                            <span class="num" v-if="info.price != 0"> ￥{{ info.price }}</span>
                            <span v-if="info.price != 0 && info.is_pay == 2" class="btn" @click="openLib">购买</span>
                            <div class="price" :style="videoType ? styleBlack2 : ''" v-if="info.price == 0">
                                <span>免费资源库</span>
                            </div>
                        </div>

                        <div class="cod" :style="videoType ? styleBlack2 : ''">
                            <span v-if="info.is_save == 2" @click="saveLib()">收藏</span>
                            <span v-if="info.is_save == 1" @click="saveLib()">取消收藏</span>
                            <span @click="openShare"> | 分享 </span>
                        </div>
                    </div>
                </div>
                <div class="classify" :style="videoType ? styleBlack : ''">
                    <div class="ltab">
                        <div class='tabs'>
                            <lTab :videoType="videoType" @changeTab="changeTab" :tabs="tabs" />
                        </div>
                        <div :class="{ search: true, cover: cover }" :style="videoType ? styleBlack : ''">
                            <input ref="searchs" @focus="getfocus" type="text" placeholder="" placeholder-class="pla"
                                v-model="keyword" @keyup.enter="goSearch">
                            <img src="@/assets/img/search.svg" alt="" @click="goSearch">
                        </div>
                    </div>
                    <div class="classList">
                        <!-- 搜索 -->
                        <div class="sousuo" v-show="cover">
                            <div class="sstop">
                                <p style="color: #1068E7;">搜索结果</p>
                                <el-button type="danger" @click="closeSearch" round>关闭</el-button>
                            </div>


                            <div class="ptabs" style="padding-bottom: 0;" v-infinite-scroll="load7"
                                :infinite-scroll-distance="10" :infinite-scroll-immediate="false">
                                <div v-for="(item, index) in slist" :key="index">
                                    <div :class="{ line1: true, videoType: videoType }" @click="checkSearch(item)">
                                        {{ item.name }} 【{{ item.type == 'chp' ? '目录' : '文库' }}】</div>
                                </div>
                                <el-empty description="没有内容了" v-if="slist.length == 0"></el-empty>

                            </div>
                        </div>
                        <!-- //目录 -->
                        <div class="mulu" v-if="currentTab == 0 && !cover" v-infinite-scroll="load2"
                            :infinite-scroll-distance="0" :infinite-scroll-immediate="false">
                            <el-tree accordion icon-class="el-icon-folder-opened" node-key="id" :data="data"
                                :props="defaultProps" @node-click="handleNodeClick">
                                <span class="custom-tree-node" slot-scope="{ node }">
                                    <div class="dashed" v-if="!node.data.type">
                                        <span></span>
                                    </div>
                                    <img class="typeImg" src="@/assets/img/text.png" v-if="!node.data.type" alt="">
                                    <span class="txt2" @click="checkChapter(node.data.id)" v-if="!node.data.type">{{
                                        node.label
                                    }}</span>

                                    <span class="txt1" style="" v-if="node.data.type">{{
                                        node.label }}</span>
                                </span>
                            </el-tree>
                        </div>
                        <!-- 评论 -->
                        <div class="pinglun" v-if="currentTab == 1 && !cover">
                            <!-- <p :style="{ color: videoType ? '#fff' : '' }">全部评论 595</p> -->
                            <div class="ptabs" v-infinite-scroll="load3" :infinite-scroll-distance="10"
                                :infinite-scroll-immediate="false">
                                <lComment :videoType="videoType" :color="videoType ? '#000' : ''"
                                    v-for="(item, index) in comlist" :border="index != comlist.length - 1" :key="index"
                                    @goComm="goComm" @goOpen="goOpen" @goReport="openReport" :list="item"
                                    @reList="getComId" @reList1="getComId1" />

                                <el-empty description="没有内容了" v-if="comlist.length == 0"></el-empty>

                            </div>
                            <div class="pushPl" :style="{ backgroundColor: videoType ? '#000' : '' }">
                                <div class="callback" v-if="commuser.user_nickname">
                                    <div><span style="color:#1068E7 ;">回复：</span>{{ commuser.user_nickname }}</div>
                                    <span @click="commuser = ''">取消</span>
                                </div>
                                <el-input ref="comm" type="text" v-model="comment">
                                </el-input>
                                <span class="append" @click="addComm()"> 评论</span>
                            </div>
                        </div>
                        <!-- 摘抄 -->
                        <div class="zhaichao" v-if="currentTab == 2 && !cover" v-infinite-scroll="load4"
                            :infinite-scroll-distance="10" :infinite-scroll-immediate="false">
                            <div>
                                <lExcerpt @onLike="onLike" :videoType="videoType" v-for="item in excerpt" :key="item.id"
                                    :list="item" @reList="getExpId" />
                                <el-empty description="没有内容了" v-if="excerpt.length == 0"></el-empty>
                                <!-- <lExcerpt :color="videoType ? '#000' : '#E7F1FE'" @onLike="onLike"
                                    :videoType="videoType" v-for="(item, index) in zList" :key="index" /> -->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div v-if="$store.getters.isMobile" class="mul" @click="drawer = true">
                <img src="@/assets/img/mul.png" alt="">
                <span>目录</span>
            </div>
            <el-drawer v-if="$store.getters.isMobile" size="90%" :visible.sync="drawer" direction="rtl">
                <div class="tabList" :style="videoType ? styleBlack : ''">
                    <div class="top" :style="videoType ? styleBlack2 : ''">
                        <p class="title" :style="videoType ? styleBlack2 : ''">
                            {{ info.name }}
                        </p>

                        <div class="other">
                            <div class="price" :style="videoType ? styleBlack2 : ''">
                                <span class="num" v-if="info.price != 0"> ￥{{ info.price }}</span>
                                <span v-if="info.price != 0 && info.is_pay == 2" class="btn" @click="openLib">购买</span>
                                <div class="price" :style="videoType ? styleBlack2 : ''" v-if="info.price == 0">
                                    <span>免费资源库</span>
                                </div>
                            </div>

                            <div class="cod" :style="videoType ? styleBlack2 : ''">
                                <span v-if="info.is_save == 2" @click="saveLib()">收藏</span>
                                <span v-if="info.is_save == 1" @click="saveLib()">取消收藏</span>
                                <span @click="openShare"> | 分享 </span>
                            </div>
                        </div>
                    </div>
                    <div class="classify" :style="videoType ? styleBlack : ''">
                        <div class="ltab">
                            <lTab ref="tab" :videoType="videoType" @changeTab="changeTab" :tabs="tabs" />
                            <img v-if="!cover" @click="cover = true" src="@/assets/img/search.svg" alt="">
                            <div v-else :class="{ search: true, cover: cover }" :style="videoType ? styleBlack : ''">
                                <input ref="searchs" @focus="getfocus" type="text" placeholder=""
                                    placeholder-class="pla" v-model="keyword" @keyup.enter="goSearch">
                                <img src="@/assets/img/search.svg" alt="" @click="goSearch" @keyup.enter="goSearch">
                            </div>
                        </div>
                        <div class="classList">
                            <!-- 搜索 -->
                            <div class="sousuo" v-show="cover">
                                <div class="sstop">
                                    <p style="color: #1068E7;">搜索结果</p>
                                    <el-button type="danger" @click="closeSearch" round>关闭</el-button>
                                </div>


                                <div class="ptabs" style="padding-bottom: 0;" v-infinite-scroll="load7"
                                    :infinite-scroll-distance="10" :infinite-scroll-immediate="true">
                                    <div v-for="(item, index) in slist" :key="index">
                                        <div :class="{ line1: true, videoType: videoType }" @click="checkSearch(item)">
                                            {{ item.name }} 【{{ item.type == 'chp' ? '目录' : '文库' }}】</div>
                                    </div>
                                    <el-empty description="没有内容了" v-if="slist.length == 0"></el-empty>

                                </div>
                            </div>
                            <!-- //目录 -->
                            <div class="mulu" v-if="currentTab == 0 && !cover" v-infinite-scroll="load2"
                                :infinite-scroll-distance="0" :infinite-scroll-immediate="true">
                                <el-tree accordion icon-class="el-icon-folder-opened" node-key="id" :data="data"
                                    :props="defaultProps" @node-click="handleNodeClick">
                                    <span class="custom-tree-node" slot-scope="{ node }">
                                        <div class="dashed" v-if="!node.data.type">
                                            <span></span>
                                        </div>
                                        <img class="typeImg" src="@/assets/img/text.png" v-if="!node.data.type" alt="">
                                        <span class="txt2" @click="checkChapter(node.data.id)" v-if="!node.data.type">{{
                                            node.label
                                            }}</span>

                                        <span class="txt1" style="" v-if="node.data.type">{{
                                            node.label }}</span>
                                    </span>
                                </el-tree>
                            </div>
                            <!-- 评论 -->
                            <div class="pinglun" v-if="currentTab == 1 && !cover">
                                <!-- <p :style="{ color: videoType ? '#fff' : '' }">全部评论 595</p> -->
                                <div class="ptabs" v-infinite-scroll="load3" :infinite-scroll-distance="10"
                                    :infinite-scroll-immediate="true">
                                    <lComment :videoType="videoType" :color="videoType ? '#000' : ''"
                                        v-for="(item, index) in comlist" :border="index != comlist.length - 1"
                                        :key="index" @goComm="goComm" @goOpen="goOpen" @goReport="openReport"
                                        :list="item" @reList="getComId" @reList1="getComId1" />

                                    <el-empty description="没有内容了" v-if="comlist.length == 0"></el-empty>

                                </div>
                                <div class="pushPl" :style="{ backgroundColor: videoType ? '#000' : '' }">
                                    <div class="callback" v-if="commuser.user_nickname">
                                        <div><span style="color:#1068E7 ;">回复：</span>{{ commuser.user_nickname }}</div>
                                        <span @click="commuser = ''">取消</span>
                                    </div>
                                    <el-input ref="comm" type="text" v-model="comment">
                                    </el-input>
                                    <span class="append" @click="addComm()"> 评论</span>
                                </div>
                            </div>
                            <!-- 摘抄 -->
                            <div class="zhaichao" v-if="currentTab == 2 && !cover" v-infinite-scroll="load4"
                                :infinite-scroll-distance="10" :infinite-scroll-immediate="true">
                                <div>
                                    <lExcerpt @onLike="onLike" :videoType="videoType" v-for="item in excerpt"
                                        :key="item.id" :list="item" @reList="getExpId" />
                                    <el-empty description="没有内容了" v-if="excerpt.length == 0"></el-empty>
                                    <!-- <lExcerpt :color="videoType ? '#000' : '#E7F1FE'" @onLike="onLike"
                                    :videoType="videoType" v-for="(item, index) in zList" :key="index" /> -->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </el-drawer>
            <!-- 弹窗 -->
            <el-dialog :close-on-click-modal="false" :visible.sync="dialogVisible" width="800px">
                <span slot="title" class="dialog-footer">
                    选取段落：{{ tip }}
                </span>
                <div class="pop">
                    <el-input :autosize="{ minRows: 2, maxRows: 4 }" :readOnly="tip != '摘抄'" style="font-size: 18px;"
                        type="textarea" v-model="selectedText"></el-input>
                    <el-form style="margin-top: 60px;" inline ref="form" :model="form" v-if="tip == '摘抄'">
                        <el-form-item label="出处:">
                            <el-input v-model="form.source" placeholder="请输入出处"></el-input>
                        </el-form-item>
                        <el-form-item label="作者:">
                            <el-input v-model="form.author" placeholder="请输入作者"></el-input>
                        </el-form-item>
                    </el-form>
                    <el-form v-else inline ref="form">
                        <el-form-item label="评论内容:">
                        </el-form-item>
                        <el-input placeholder="请输入评论内容..." style="font-size: 18px;" type="textarea"
                            v-model="pl"></el-input>
                    </el-form>
                    <div class="comment" v-if="tip != '摘抄'">
                        <p>评论列表：</p>
                        <div class="listCom" v-infinite-scroll="load" :infinite-scroll-distance="10"
                            :infinite-scroll-immediate="false">
                            <div v-for="(item, index) in comList" :key="item.id">
                                <lComment :set="false" :list="item" :border="index != comList.length - 1" />
                            </div>
                            <div v-if="loading" v-loading="loading">
                            </div>
                        </div>
                    </div>
                </div>

                <span slot="footer" class="dialog-footer" v-if="tip != '摘抄'">
                    <el-button size="medium" @click="closeDia">取 消</el-button>
                    <el-button type="primary" @click="addPara">确 定</el-button>
                </span>
                <span slot="footer" class="dialog-footer" v-if="tip == '摘抄'">
                    <el-button size="medium" @click="closeDia">取 消</el-button>
                    <el-button type="primary" @click="addExcerpt">确 定</el-button>
                </span>
            </el-dialog>
            <buyDia ref="buyDia" :info="ainfo" @onstop="clearTimer"></buyDia>


            <el-dialog top="40vh" title="提示" :visible.sync="showLib" width="350px" @close="goBack">
                <span slot="title" class="dialog-header" style="font-size: 18px;">
                    <i style="color:#d41f19;margin-right: 12px;" class="el-icon-money"></i>资源库支付方式
                </span>
                <span class="dialog-footer2">
                    <el-button type="success" @click="buyNow(1)">微信支付</el-button>
                    <el-button type="primary" @click="buyNow(2)">余额支付</el-button>
                </span>
            </el-dialog>

            <!-- 评论举报弹窗 -->
            <el-dialog :visible.sync="dialogVisible5" width="700px" @close="closeDiajb">
                <span slot="title" class="dialog-header">
                    <i style="color:#d41f19;margin-right: 12px;" class="el-icon-warning"></i>举报
                </span>
                <el-form ref="form" label-width="6.25vw">
                    <el-form-item label="举报对象:">
                        <el-input :value="reUname" disabled></el-input>
                    </el-form-item>

                    <div class="select">
                        <el-form-item label="举报类型:" required>
                            <el-select filterable v-model="form3.reason" placeholder="请选择类型">
                                <el-option v-for="(item, index) in jbly" :label="item" :value="item"
                                    :key="index"></el-option>
                            </el-select>
                        </el-form-item>
                    </div>
                    <div class="textarea">
                        <el-form-item label="举报说明:" require>
                            <el-input type="textarea" v-model="form3.remark" placeholder="请输入举报说明"></el-input>
                        </el-form-item>
                    </div>
                </el-form>
                <span slot="footer" class="dialog-footer">
                    <el-button @click="dialogVisible5 = false">取 消</el-button>
                    <el-button type="primary" @click="onsubmit3">确 定</el-button>
                </span>
            </el-dialog>

            <ShareDia ref="shareDia" :info="shareInfo"></ShareDia>


        </div>
    </div>
</template>

<script>
import { baseUrl } from '@/apis/index'

import { saveAs } from 'file-saver';
import axios from 'axios';
import text from "@/assets/img/text.png"
import lExcerpt from "./l-excerpt/index.vue"
import lComment from "./l-comment/index.vue"
import lTab from "@/components/lTab.vue"
import buyDia from "@/components/buyDia.vue"
import ShareDia from "@/components/shareDia.vue"


export default {
    components: {
        lComment,
        lTab,
        lExcerpt,
        buyDia,
        ShareDia
    },
    data() {
        return {
            keyword: '',
            drawer: false,
            dialogVisible5: false,
            jbly: [],
            giftnum: 1,
            swiperOptions: {
                slidesPerView: 4,
                spaceBetween: 30,
                navigation: {
                    nextEl: '.swiper-button-next',
                    prevEl: '.swiper-button-prev',
                },
            },
            slides: [],
            giftId: '1',
            loading: false,
            focus: false,
            richText: `\n  <span>此开卷第一回也。作者自云：<span style='color: #1068E7;'>因曾历过一番梦幻之后</span>，故将真事隐去，而借“通灵”之说，撰此《石头记》一书也。故曰“甄士隐”云云。但书中所记何事何人？自又云：“今风尘碌碌，一事无成，忽念及当日所有之女子，一一细考较去，觉其行止见识，<span style='color: #1068E7;'>皆出于我之上</span>。何我堂堂须眉，诚不若彼裙钗哉？实愧则有余，悔又无益之大无可如何之日也！</span > <span class='num'>2</span></br><span>当此，则自欲将已往所赖天恩祖德，锦衣纨э之时，饫甘餍肥之日，背父兄教育之恩，负师友规谈之德，以至今日一技无成，半生潦倒之罪，编述一集，<span style='color: #1068E7;'>以告天下人</span>：我之罪固不免，然闺阁中本自历历有</span > <span class='num'>1</span>\n`,
            showMenu: false, // 是否显示菜单
            menuStyle: { top: '0', left: '0' }, // 菜单位置
            selectedRange: null,// 存储选中的范围
            selectedText: '',
            dialogVisible: false,
            dialogVisible2: false,
            dialogVisible3: false,
            tip: '评论',
            form: {
                source: '',
                author: ''
            },
            form2: {
                type: '',
                name: '',
                remark: ''
            },
            form3: {
                reason: '',
                remark: ''
            },
            pl: '',
            totalPage: 1,
            pageNum: 1,
            comList: [],
            tabs: ['目录', '评论', '摘抄'],
            currentTab: 0,
            muluList: [],
            rPList: [],
            comment: '',
            commuser: {},
            zList: [],
            typeImg: {
                text
            },
            videoType: false,
            videoSrc: '',
            styleBlack: {
                background: '#000',
            },
            styleBlack2: {
                color: '#fff'
            },
            closeMsg: true,
            cover: false,
            data: [],
            defaultProps: {
                children: 'children',
                label: 'label'
            },
            id: 0,
            info: {},
            list: [],
            chapter: [],
            cinfo: {},
            cu_chpid: 0,
            col_id: '',
            loading3: false,
            totalPage3: 1,
            pageNum3: 1,
            ctotal: 0,
            comlist: [],
            loading4: false,
            totalPage4: 1,
            pageNum4: 1,
            excerpt: [],
            ainfo: {},
            showPay: false,
            timer: null,
            showLib: false,
            shareInfo: {},
            slist: [], // 搜索结果
            sloading: false,
            stotalPage: 1,
            spageNum: 1,// 推荐列表
            reUname: ''

        }
    },
    mounted() {
        // 监听 selectionchange 事件
        document.addEventListener('selectionchange', this.handleSelectionChange);
        this.id = this.$route.query.id

        if (this.id) {
            this.getInfo()
            this.getChapter()
        }
        this.getOption()

    },

    methods: {
        closeSearch() {
            this.cover = false
            this.keyword = ''
            this.slist = []
        },
        //  搜索
        load7() {
            console.log('搜索触底');

            var page = this.spageNum
            //如果请求未结束就返回不连续请求
            if (this.loading) {
                return
            }
            //数据请求完成无更多数据时
            if (page >= this.stotalPage) {
                return false;
            }
            page = parseInt(page) + 1
            this.spageNum = page
            this.searchCol()
        },
        goSearch() {

            this.slist = []
            this.spageNum = 1
            this.searchCol()
        },

        searchCol() {
            this.sloading = true
            let params = {
                page: this.spageNum,
                keyword: this.keyword,
                id: this.col_id,
                is_lib: 1,
                lib_id: this.id
            }

            this.$api.searchCol(params).then(res => {
                let response = res.data.data
                if (res.data.code == 1) {
                    this.stotalPage = response.last_page
                    this.slist = this.slist.concat(response.data);
                    this.sloading = false
                }

            })
        },


        // 评论举报
        onsubmit3() {
            this.form3.op = 3
            let params = this.form3

            this.$api.reportNow(params).then(res => {
                if (res.data.code == 1) {
                    this.$message({
                        message: '提交成功',
                        type: 'success'
                    })

                    this.form3.remark = ''
                    this.form3.reason = ''
                    this.dialogVisible5 = false

                }
            })

        },
        closeDiajb() {
            this.form2 = {
                reason: '',
                remark: ''
            };
            this.form3 = {
                reason: '',
                remark: ''
            }
        },

        openNow(title = '') {
            const fullUrl = window.location.href;
            this.shareInfo = {
                title: title ? title : this.info.name,
                link: fullUrl,
                img: baseUrl + 'home/base/qrcod?url=' + fullUrl
            };
            this.$refs.shareDia.open()

        },
        goBack() {
            // 关闭弹窗返回列表页
            this.$router.back()
        },
        // 打开分享弹窗并记录
        openShare() {
            let params = {
                id: this.id,
                op: 5
            }
            this.$api.addShare(params).then(res => {
                if (res.data.code == 1) {
                    this.openNow()

                }
            })
        },
        // 选择支付方式
        openLib() {
            this.showLib = true
        },

        query_lib(id) {
            // 3秒定时执行
            this.timer = setInterval(() => {
                let params = {
                    id
                }

                this.$api.queryLibrary(params).then(res => {
                    if (res.data.code == 1) {
                        this.showPay = false
                        this.$message({
                            message: '购买成功',
                            type: 'success'
                        })
                        this.$refs.buyDia.close()
                        this.getInfo()
                        this.clearTimer()
                    }
                })
            }, 3000)
        },

        clearTimer() {
            if (this.timer) {
                clearInterval(this.timer)
                this.timer = null
            }

        },



        // 购买专栏
        buyNow(op) {
            this.ainfo.price = this.info.price
            this.ainfo.id = this.id
            this.ainfo.op = 1 //专栏订单
            let params = {
                id: this.id,
                pay_op: op
            }
            this.$api.payLib(params).then(res => {
                let response = res.data.data
                if (res.data.code == 1) {
                    this.showLib = false
                    if (op == 1) {
                        this.ainfo.img = baseUrl + 'home/base/qrcod?url=' + response.code_url;
                        this.query_lib(res.data.data.id)
                        this.$refs.buyDia.open()
                    } else {
                        this.$message({
                            message: '购买成功',
                            type: 'success'
                        })
                        this.getInfo()
                    }
                }
            })

        },

        getExpId(info) {
            let list = this.excerpt
            let id = info.id
            let op = info.op
            let status = info.status

            list.forEach((i, d) => {
                if (id == i.id) {
                    if (op == 2) {
                        this.excerpt[d].is_like = status
                        // 点赞
                        if (status == 1) {
                            this.excerpt[d].likes += 1
                        } else {
                            this.excerpt[d].likes -= 1
                        }
                    } else {
                        console.log('摘抄id', id)
                        // 展开
                        this.excerpt[d].views += 1
                    }
                }
            })
        },


        getComId(info) {
            // 聚焦输入评论
            this.$nextTick(() => {
                this.$refs.comm.focus()
            })
            let list = this.comlist
            let id = info.id
            let status = info.status
            let op = info.op

            list.forEach((i, d) => {
                if (id == i.id) {

                    if (op == 1) {
                        // 点赞评论
                        this.comlist[d].is_like = status
                        // 点赞
                        if (status == 1) {
                            this.comlist[d].likes += 1
                        } else {
                            this.comlist[d].likes -= 1
                        }
                    }
                    else if (op == 3) {
                        this.comlist[d].shares += 1
                        let uname = this.comlist[d].user_nickname
                        let content = this.comlist[d].content
                        let title = uname + '的评论：' + content
                        this.openNow(title)
                    }
                    else {
                        // 踩评论
                        this.comlist[d].is_dislike = status
                        // 点赞
                        if (status == 1) {
                            this.comlist[d].dislikes += 1
                        } else {
                            this.comlist[d].dislikes -= 1
                        }
                    }


                }
            })
        },


        getComId1(info) {
            const { id, status, op } = info;
            let updated = false;

            // 创建深拷贝以避免直接修改原始数据（Vue响应式需要）
            const updatedList = JSON.parse(JSON.stringify(this.comlist));

            // 递归查找并更新评论
            const updateComment = (comments) => {
                for (let i = 0; i < comments.length; i++) {
                    const comment = comments[i];

                    // 检查当前评论是否匹配
                    if (comment.id === id) {
                        console.log('commet是', comment.id)
                        console.log('得到的id是', id)
                        console.log('op是', op, status)
                        if (op === 1) {
                            // 点赞评论
                            comment.is_like = status;
                            comment.likes += status === 1 ? 1 : -1;
                        } else if (op === 3) {
                            // 分享
                            comment.shares += 1;
                            const title = `${comment.user_nickname}的评论：`;
                            this.openNow(title);
                        } else {
                            // 踩评论
                            comment.is_dislike = status;
                            comment.dislikes += status === 1 ? 1 : -1;
                        }
                        return true; // 找到并更新了评论
                    }

                    // 检查回复评论
                    if (comment.rep_list && comment.rep_list.length > 0) {
                        if (updateComment(comment.rep_list)) {
                            return true; // 在回复中找到并更新了评论
                        }
                    }
                }
                return false;
            };

            // 执行更新
            updateComment(updatedList);

            // 更新Vue数据（确保响应式）
            this.comlist = updatedList;
        },



        // 段落评论
        addPara() {
            let params = {
                id: this.cinfo.id,
                chose: this.selectedText,
                content: this.pl
            }
            this.$api.paraCol(params).then(res => {
                if (res.data.code == 1) {
                    this.$message({
                        message: res.data.msg,
                        type: 'success'
                    })
                    this.dialogVisible = false
                    this.pl = ''
                    this.getChapterInfo(this.cinfo.id)

                }
            })
        },


        // 提交摘抄
        addExcerpt() {
            let params = {
                id: this.col_id,
                content: this.selectedText,
                source: this.form.source,
                author: this.form.author
            }
            this.$api.addExpcerpt(params).then(res => {
                if (res.data.code == 1) {
                    this.$message({
                        message: res.data.msg,
                        type: 'success'
                    })
                    this.dialogVisible = false
                    this.form.author = ''
                    this.form.source = ''

                }
            })
        },

        // 评论专栏
        addComm() {

            let reply_id = this.commuser.id ? this.commuser.id : 0
            let params = {
                id: this.col_id,
                content: this.comment,
                op: 1,
                reply_id
            }
            this.$api.addCommet(params).then(res => {
                if (res.data.code == 1) {
                    this.$message({
                        message: '感谢你的评论',
                        type: 'success'
                    })

                    // 聚焦输入评论
                    this.$nextTick(() => {
                        this.$refs.comm.focus()
                    })

                    this.pageNum3 = 1
                    this.comment = ''
                    this.comlist = []
                    this.getComment()
                }
            })
        },
        getExcerpt() {
            this.loading4 = true
            let params = {
                page: this.pageNum4,
                id: this.col_id
            }
            this.$api.getColexcerpt(params).then(res => {
                this.totalPage4 = res.data.data.last_page
                this.excerpt = this.excerpt.concat(res.data.data.data);
                this.loading4 = false
            })
        },

        saveLib() {
            let params = {
                id: this.id
            }
            this.$api.saveLib(params).then(res => {
                if (res.data.code == 1) {
                    this.info.is_save = res.data.data
                    this.getInfo()
                }
            })
        },
        getNewList() {
            // 聚焦输入评论
            this.$nextTick(() => {
                this.$refs.comm.focus()
            })
            this.comlist = []

            this.pageNum3 = 1
            this.getComment()
        },
        getNewList1() {
            this.excerpt = []
            this.pageNum4 = 1
            this.getExcerpt()
        },


        // 评论
        getComment() {
            this.loading3 = true
            let params = {
                page: this.pageNum3,
                id: this.col_id,
                op: 1,
                is_reply: 0
            }
            this.$api.getcomment(params).then(res => {
                this.totalPage3 = res.data.data.last_page
                this.comlist = this.comlist.concat(res.data.data.data);
                this.loading3 = false
                this.ctotal = res.data.data.total
            })
        },

        // 礼物打赏列表
        getGiftList() {
            this.$api.getGift().then(res => {
                this.slides = res.data.data
            })
        },
        getOption() {
            let params = {
                type: 'jbly'
            }
            this.$api.getOptions(params).then(res => {
                if (res.data.code == 1) {
                    this.jbly = res.data.data.jbly

                }
            })
        },
        // 资源库详情
        getInfo() {
            let params = {
                id: this.id
            }
            this.$api.getLibInfo(params).then(res => {
                if (res.data.code == 1) {
                    this.info = res.data.data
                }
            })
        },
        // 目录
        getChapter() {
            this.loading = true
            let params = {
                page: this.pageNum,
                id: this.id
            }
            this.$api.getLibChapter(params).then(res => {
                if (res.data.code == 1) {
                    // this.totalPage = res.data.data.last_page
                    this.data = this.data.concat(res.data.data);
                    this.loading = false

                    if (this.data.length != 0) {
                        this.col_id = this.data[0].id


                        if (this.data[0].children.length != 0) {
                            this.cu_chpid = this.data[0].children[0].id,
                                this.getChapterInfo(this.cu_chpid)
                        }
                    } else {
                        this.$message({
                            message: '资源库没有绑定专栏或目录',
                            type: 'error'
                        })

                        this.$router.back()

                    }

                }

            })
        },
        getChapterInfo(id) {
            let params = {
                id,
                is_lib: 1,
                lib_id: this.id
            }
            this.$api.getChapterInfo(params).then(res => {
                if (res.data.code == 1) {
                    let response = res.data.data
                }
            })
        },
        openReport(item) {
            this.form3.id = item.id
            this.reUname = item.user_nickname
            this.dialogVisible5 = true
        },
        handleNodeClick(data) {
        },
        //选中礼物
        getGift(id) {
            this.giftId = id
        },
        onLike(id) {
            console.log(id);

        },
        onsubmit2() {
            console.log(this.form2);

        },
        muluTry(item) {
            console.log('点击试读', item);

        },
        async downloadFile(url, filename) {
            try {
                // 使用 axios 获取文件
                const response = await axios.get(url, {
                    responseType: 'blob', // 重要：指定响应类型为 blob
                });

                // 使用 FileSaver.js 保存文件
                saveAs(new Blob([response.data]), filename);
                this.$message({
                    message: '文件下载成功',
                    type: 'success'
                })
            } catch (error) {
                this.$message({
                    message: '文件下载失败',
                    type: 'error'
                })

            }
        },
        goPage(url, cid) {

            this.$router.push({
                path: url,
                query: {
                    id: this.id,
                    cid
                }
            })
        },

        ClickMulu(item) {
            this.videoType = !this.videoType
            console.log('点击目录', item);

        },
        checkChapter(id) {
            console.log('当前目录的id是', id)
            // this.getChapterInfo(id)
            this.goPage('/resource/read', id)


        },
        // 右侧目录触底
        load2() {
            console.log('触底');
        },
        // 右侧评论触底
        load3() {
            var page = this.pageNum3
            //如果请求未结束就返回不连续请求
            if (this.loading3) {
                return
            }
            //数据请求完成无更多数据时
            if (page >= this.totalPage3) {
                return false;
            }
            page = parseInt(page) + 1
            this.pageNum3 = page
            this.getComment()
        },
        // 右侧摘抄触底
        load4() {
            console.log('触底');
            var page = this.pageNum4
            //如果请求未结束就返回不连续请求
            if (this.loading4) {
                return
            }
            //数据请求完成无更多数据时
            if (page >= this.totalPage4) {
                return false;
            }
            page = parseInt(page) + 1
            this.pageNum4 = page
            this.getExcerpt()
        },
        // 右侧摘抄触底
        load5() {
            console.log('触底');
        },
        // 弹窗评论触底
        load() {
            var page = this.pageNum
            //如果请求未结束就返回不连续请求
            if (this.loading) {
                return
            }
            //数据请求完成无更多数据时
            if (page >= this.totalPage) {
                return false;
            }
            page = parseInt(page) + 1
            this.pageNum = page
            this.getParaList()
        },
        // 切换tab
        changeTab(index) {
            console.log(index);
            this.currentTab = index
            if (index == 1) {
                this.comlist = []
                this.pageNum = 1
                this.$nextTick(() => {
                    this.$refs.comm.focus()
                })
                this.getComment()
            }

            // 摘抄
            if (index == 2) {
                this.excerpt = []
                this.pageNum4 = 1
                this.getExcerpt()
            }
        },
        // 数据请求
        getParaList() {
            this.loading = true
            // this.closeMsg=false
            let params = {
                page: this.pageNum,
                chose: this.selectedText,
                id: this.cinfo.id
            }
            this.$api.getParaList(params).then(res => {
                console.log(res);
                this.totalPage = res.data.data.last_page
                this.comList = this.comList.concat(res.data.data.data);
                this.loading = false
            })
        },
        goComm(item) {
            console.log(item);
            this.commuser = item
            this.$refs.comm.focus()
        },
        goOpen(id) {
            console.log(id);
        },
        handleSelectionChange() {
            const selection = window.getSelection();
            const selectedText = selection.toString().trim();
            if (selectedText === '') {
                this.showMenu = false
            }
        },
        getfocus() {
            this.cover = true

        },
        getblur() {
            this.cover = false
        },
        // 获取选中文字
        getSelectedText(t) {
            if (t == 'zc') {
                this.tip = '摘抄'
            } else {
                this.tip = '评论'
            }
            const selection = window.getSelection();
            const selectedText = selection.toString().trim();
            this.selectedText = selectedText
            this.dialogVisible = true
            this.comList = []
            this.totalPage = 1
            this.pageNum = 1
            this.getParaList()

        },
        closeDia() {
            this.dialogVisible = false
            if (window.getSelection) {
                window.getSelection().removeAllRanges();
            } else if (document.selection) {
                document.selection.empty(); // 兼容旧版 IE
            }
        },

        // 鼠标左键松开时触发
        handleMouseUp(event) {
            const selection = window.getSelection();
            const selectedText = selection.toString().trim();
            if (selectedText !== '' && this.$refs.htmlContainer.contains(selection.anchorNode)) {
                // 显示菜单，并设置菜单位置
                this.showMenu = true;
                this.menuStyle = {
                    top: `${event.clientY}px`,
                    left: `${event.clientX}px`
                };
                // 存储选中的范围
                this.selectedRange = selection.getRangeAt(0);
            } else {
                this.showMenu = false;
            }
        },

    },
    beforeDestroy() {
        // 移除事件监听
        document.removeEventListener('selectionchange', this.handleSelectionChange);
    },
}
</script>

<style lang="scss" scoped>
/* 自定义菜单样式 */
.custom-menu {
    position: fixed;
    background-color: white;
    border: 1px solid #ccc;
    padding: 5px;
    z-index: 1000;
    border-radius: 10px;
    background-color: #1068E7;
}

.custom-menu button {
    display: block;
    width: 100%;
    padding: 5px 10px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: #fff;
}

.custom-menu button:hover {
    color: #1068E7;
    background-color: #fff;
}

.main-con {
    border-top: 1px solid #D6D6D6;
    display: flex;
}

.media {
    width: 1080px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 119px);
    padding-right: 30px;
    position: relative;

    &::-webkit-scrollbar {
        width: 0;

    }

    >p {
        font-weight: 400;
        font-size: 20px;
        color: #FFFFFF;
        line-height: 48px;
        padding: 35px 0;

    }

    >video {
        width: 100%;
        height: 500px;
    }

    .setList {
        display: flex;
        margin-top: 30px;

        >div {
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 400;
            font-size: 14px;
            color: #666666;
            margin-right: 28px;

            i {
                margin-right: 6px;
            }
        }
    }
}

.article {

    .all {
        width: 1080px;
        // overflow-y: hidden;
        display: flex;
        flex-direction: column;
        height: calc(100vh - 100px);
        position: relative;
        overflow-y: auto;

        &::-webkit-scrollbar {
            width: 0;

        }

        margin-top: 30px;

        .bookImg {
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 120px;

            img {
                width: 100%;
                height: auto;
            }
        }

        .top {
            padding: 0 27px 19px;
            min-height: 211px;

            .title {
                padding: 37px 0 23px;
                font-weight: bold;
                font-size: 36px;
                color: #1068E7;


            }

            .author {
                font-weight: 400;
                font-size: 16px;
                color: #333333;

                >span {
                    display: inline-block;
                    margin-right: 30px;
                }
            }

            .other {
                margin-top: 15px;
                display: flex;
                align-items: center;
                font-size: 16px;
                color: #333333;

                .price {
                    font-weight: 400;
                    font-size: 16px;
                    color: #333333;
                    display: flex;
                    align-items: center;

                    span {
                        margin-right: 15px;
                        font-size: 16px;
                        color: #333333;

                    }
                }

                .cod {
                    font-size: 16px;
                    color: #333333;
                    cursor: pointer;
                    flex: 1;
                    display: flex;
                    justify-content: flex-end;

                    >span {
                        margin-left: 8px;
                        border-right: 1px solid #000;
                        padding-right: 8px;

                        &:last-child {
                            border: none;
                            padding-right: 0;
                        }

                        &:first-child {
                            margin-left: 0;
                        }
                    }
                }
            }

            .tron {
                font-size: 20px;
                color: #000000;
                margin-top: 30px;
            }
        }


        .vhtml {
            margin-top: 27px;
            width: 1080px;
            -ms-overflow-style: none;

            &::-webkit-scrollbar {
                width: 0;

            }

            .richText {
                width: 1080px;
                padding-right: 120px;
                padding-bottom: 40px;
                font-weight: 400;
                font-size: 22px;
                color: #000000;
                line-height: 60px;

                ::v-deep span,
                div,
                p {
                    font-family: Microsoft YaHei;
                    font-weight: 400;
                    font-size: 22px;
                    color: #000000;
                    line-height: 40px;
                }

                ::v-deep .num {
                    width: 20px;
                    height: 20px;
                    display: inline-flex;
                    justify-content: center;
                    text-align: center;
                    color: #FF0000;
                    align-items: center;
                    border: 1px solid #FF0000;
                    border-radius: 50%;
                    box-sizing: content-box;
                    font-size: 16px;
                    user-select: none;
                    /* 标准语法 */
                    -webkit-user-select: none;
                    /* Safari */
                    -moz-user-select: none;
                    /* Firefox */
                    -ms-user-select: none;
                    /* IE/Edge */
                }
            }

            .setList {
                position: absolute;
                bottom: 22px;
                right: 70px;
                z-index: 8;

                >div {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    font-weight: 400;
                    font-size: 14px;
                    color: #666666;
                    margin-bottom: 10px;

                    i {
                        margin-bottom: 2px;
                        font-size: 25px;
                    }
                }
            }
        }
    }





    width: 1080px;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 119px);
    position: relative;

    &::-webkit-scrollbar {
        width: 0;

    }

    >p {
        width: 960px;
        font-family: Microsoft YaHei;
        font-weight: bold;
        font-size: 36px;
        color: #1068E7;
        line-height: 48px;
        padding: 35px 0;
        border-bottom: 1px solid #D6D6D6;
    }

    .vhtml {
        margin-top: 27px;
        flex: 1;
        width: 1080px;
        overflow-y: auto;
        -ms-overflow-style: none;

        &::-webkit-scrollbar {
            width: 0;

        }

        .richText {
            width: 1080px;
            padding-right: 120px;
            padding-bottom: 40px;
            font-family: Microsoft YaHei;
            font-weight: 400;
            font-size: 22px;
            color: #000000;
            line-height: 60px;

            ::v-deep span,
            div,
            p {
                font-family: Microsoft YaHei;
                font-weight: 400;
                font-size: 22px;
                color: #000000;
                line-height: 60px;
            }

            ::v-deep .num {
                width: 20px;
                height: 20px;
                display: inline-flex;
                justify-content: center;
                text-align: center;
                color: #FF0000;
                align-items: center;
                border: 1px solid #FF0000;
                border-radius: 50%;
                box-sizing: content-box;
                font-size: 16px;
                user-select: none;
                /* 标准语法 */
                -webkit-user-select: none;
                /* Safari */
                -moz-user-select: none;
                /* Firefox */
                -ms-user-select: none;
                /* IE/Edge */
            }
        }

        .setList {
            position: absolute;
            bottom: 22px;
            right: 70px;
            z-index: 333;

            >div {
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                font-weight: 400;
                font-size: 14px;
                color: #666666;
                margin-bottom: 10px;

                i {
                    margin-bottom: 2px;
                    font-size: 25px;
                }
            }
        }
    }
}

.dialog-header {
    font-weight: bold;
    font-size: 22px;
}

.dialog-footer {
    font-weight: bold;
    font-size: 22px;
    display: flex;
    justify-content: center;
    align-items: center;

    button {
        margin: 0 50px;
    }
}

.dialog-footer2 {
    display: flex;
    justify-content: center;

    button {
        width: 90px;
        height: 40px;
        font-size: 15px;
        line-height: 40px;
        padding: 0;
    }
}


.pop {
    padding: 0 30px;

    ::v-deep .el-form-item {
        margin-bottom: 0 !important;
    }
}

.dialog-footer {
    button {
        width: 140px;
        height: 50px;
        font-size: 16px;
        line-height: 50px;
        padding: 0;
    }
}

.comment {
    margin-top: 20px;

    >p {
        font-weight: 600;
        font-size: 18px;
        color: #000000;
    }

    .listCom {
        height: 200px;
        width: 100%;
        overflow-y: auto;
        -ms-overflow-style: none;
        border: 1px solid #D6D6D6;
        margin-top: 15px;
        border-radius: 10px;
        padding: 10px 30px;

        &::-webkit-scrollbar {
            width: 2px;
        }
    }
}

.tabList {
    height: calc(100vh - 139px);
    width: 520px;
    margin-top: 20px;

    .top {
        padding: 0 27px 19px;
        height: 158px;
        background-color: #1068E7;

        .title {
            padding: 27px 0 23px;
            font-weight: bold;
            font-size: 36px;
            color: #fff;


        }

        .author {
            font-weight: 400;
            font-size: 16px;
            color: #fff;

            >span {
                display: inline-block;
                margin-right: 30px;
            }
        }

        .other {
            display: flex;
            justify-content: space-between;
            align-items: center;

            .price {
                font-weight: 400;
                font-size: 16px;
                color: #fff;
                display: flex;
                align-items: center;

                .num {
                    font-size: 28px;
                }

                .btn {
                    color: #333333;
                    cursor: pointer;
                    display: inline-block;
                    width: 60px;
                    height: 30px;
                    text-align: center;
                    line-height: 30px;
                    background-color: #F9C541;
                    margin-left: 33px;
                }
            }

            .cod {
                font-size: 16px;
                color: #fff;
                cursor: pointer;
            }
        }
    }

    .classify {
        padding-right: 30px;
        background-color: #E7F1FE;

        .ltab {
            display: flex;
            align-items: center;
            height: 111px;
            justify-content: space-between;
            position: relative;

            .tabs {
                width: 300px;
                padding-left: 20px;
            }

            .search {
                padding: 30px 0;
                box-sizing: content-box;
                position: relative;
                width: 160px;
                height: 45px;
                display: flex;
                align-items: center;

                // animation: reduceWidth .3s forwards;
                img {
                    width: 22px;
                    height: 22px;
                    cursor: pointer;
                    position: absolute;
                    top: calc(50% - 11px);
                    right: 1.2rem;
                }

                input {
                    width: 100%;
                    height: 100%;
                    outline: none;
                    background: #F6F6F6;
                    border-radius: 1.25rem;
                    padding: 0 3rem 0 1.2rem;
                    box-sizing: border-box;
                    font-size: 0.83rem;
                    border: none;
                    border: 1px solid #F6F6F6;

                    &:focus {
                        border: 1px solid #1068E7;
                    }
                }

                .pla {
                    font-weight: 400;
                    font-size: 0.83rem;
                    color: #666666;
                }
            }

            .cover {
                width: calc(100% - 30px);
                position: absolute;
                right: 0;
                top: 3px;
                background-color: #E7F1FE;
                animation: expandWidth .3s forwards;
            }

            @keyframes reduceWidth {
                0% {
                    width: calc(100% - 30px);
                }

                100% {
                    width: 160px;
                }
            }

            @keyframes expandWidth {
                0% {
                    width: 160px;
                }

                100% {
                    width: calc(100% - 30px);
                }
            }

        }
    }

    .classList {
        position: relative;

        .mulu {
            height: calc(100vh - 409px);
            overflow-y: auto;
            -ms-overflow-style: none;
            padding: 0 30px;
            min-height: 300px;

            &::-webkit-scrollbar {
                width: 0;
            }

            ::v-deep .custom-tree-node {
                display: flex;
                align-items: center;
                width: 100%;
                overflow: hidden;
                text-overflow: ellipsis;
                height: 40px;
                line-height: 40px;

                .dashed {
                    display: inline-block;
                    width: 20px;
                    height: 40px;
                    display: flex;
                    align-items: center;
                    border-left: 1px dashed #ccc;

                    >span {
                        width: 20px;
                        height: 1px;
                        border-bottom: 1px dashed #ccc;

                    }
                }

                >span {
                    width: 100%;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    height: 40px;
                }

                .typeImg {
                    width: 16px;
                    height: 16px;
                    margin-right: 10px;
                }
            }

            >div {
                margin-bottom: 30px;
                font-weight: 400;
                font-size: 20px;
                color: #333333;
                position: relative;
                cursor: pointer;

                .line1 {
                    padding-right: 20px;

                    &:hover {
                        color: #1068E7;
                    }
                }

                .videoType {
                    color: #fff;

                    &:hover {
                        color: #66CCFF;
                    }
                }

                .try {
                    position: absolute;
                    right: -40px;
                    top: 0;
                    color: #1068E7;
                }
            }
        }

        .pinglun {
            padding-left: 30px;

            >p {
                padding: 0 0 30px;
                font-weight: bold;
                font-size: 20px;
                color: #000000;
            }

            .ptabs {
                height: calc(100vh - 409px);
                overflow-y: auto;
                -ms-overflow-style: none;
                padding-bottom: 104px;
                min-height: 300px;

                &::-webkit-scrollbar {
                    width: 0;
                }


            }

            .pushPl {
                display: flex;
                align-items: center;
                position: absolute;
                bottom: 2px;
                width: 100%;
                padding: 30px 0 0;
                left: 15px;
                background-color: #E7F1FE;

                .append {
                    position: absolute;
                    right: 0px;
                    top: 30px;
                    width: 80px;
                    height: 40px;
                    line-height: 40px;
                    text-align: center;
                    cursor: pointer;
                }

                .callback {
                    width: 100%;
                    position: absolute;
                    top: 0;
                    height: 30px;
                    line-height: 30px;
                    display: flex;
                    color: #a39f9f;
                    font-size: 16px;
                    justify-content: space-between;
                    align-items: center;

                    >span {
                        cursor: pointer;
                        display: inline-block;
                        padding-right: 25px;
                        color: #f35c5c;
                    }
                }

                ::v-deep input {
                    padding-right: 80px;
                }
            }
        }

        .sousuo {
            padding-left: 30px;

            .sstop {
                padding: 0 0 30px;
                display: flex;
                justify-content: space-between;
                align-items: center;

                >p {
                    font-weight: bold;
                    font-size: 20px;
                    color: #000000;
                }
            }


            .ptabs {
                height: calc(100vh - 290px);
                overflow-y: auto;
                -ms-overflow-style: none;
                padding-bottom: 104px;
                min-height: 300px;
                width: 100%;

                &::-webkit-scrollbar {
                    width: 0;
                }

                >div {
                    margin-bottom: 30px;
                    font-weight: 400;
                    font-size: 20px;
                    color: #333333;
                    position: relative;
                    cursor: pointer;
                    width: 100%;

                    .line1 {
                        padding-right: 20px;

                        &:hover {
                            color: #1068E7;
                        }
                    }

                    .videoType {
                        color: #fff;

                        &:hover {
                            color: #66CCFF;
                        }
                    }

                    .try {
                        position: absolute;
                        right: -40px;
                        top: 0;
                        color: #1068E7;
                    }
                }
            }

        }


        .zhaichao {
            height: calc(100vh - 409px);
            overflow-y: auto;
            -ms-overflow-style: none;
            padding: 0 0 0 20px;
            min-height: 300px;

            &::-webkit-scrollbar {
                width: 0;
            }


        }


    }

}

.swiper-containers {
    width: 100%;
    height: 230px;
    position: relative;
    display: flex;
    align-items: center;
    background-color: #f0f0f0;

    .giftsilder {
        border: 1px solid #f0f0f0;
        width: 150px;
        height: 230px;
        border-radius: 6px;
        border: 1px solid #f0f0f0;
        cursor: pointer;
        margin-bottom: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;

        &:hover {
            background: #fff;
            border-color: #ec782d;
        }

        .name {
            font-size: 18px;
            color: #3f3a39;
            margin: 5px 0;
        }

        .price {
            display: block;
            font-size: 18px;
            color: #1068E7;
        }

        .img {
            width: 100%;
            height: 150px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;

            img {
                width: 80px;
                max-width: 100%;
                max-height: 100%;
                object-fit: cover;
            }
        }
    }

    .active {
        background: #fff;
        border-color: #ec782d;
    }

    ::v-deep .swiper-container {
        width: 100%;
        height: 100%;

        .swiper-button-prev {
            left: 10px;

            i {
                font-size: 30px;
                color: #ec782d;
            }

        }

        .swiper-button-prev:after {
            content: '';
        }

        .swiper-button-next:after {
            content: '';
        }

        .swiper-button-next {
            right: 10px;

            i {
                font-size: 30px;
                color: #ec782d;
            }
        }
    }



    .sildTitle {
        position: absolute;
        z-index: 8;
        bottom: 1.41rem;
        padding: 0 2.55rem;
        box-sizing: border-box;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;

        div {
            width: 11.46rem;
            cursor: pointer;
            height: 4.17rem;
            background: rgba($color: #000000, $alpha: .5);
            border-radius: 0.42rem;
            font-family: Microsoft YaHei;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.46rem;
            color: #FFFFFF;
            line-height: 1.25rem;
        }
    }
}

.nums {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 60px;

    ::v-deep .el-input-number__decrease,
    ::v-deep .el-input-number__increase {
        background-color: transparent;
    }

    .mynum {
        width: 150px;
        position: relative;

        >div {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            font-size: 14px;
            color: #999999;

            >span {
                &:first-child {
                    flex: 1;
                    font-size: 20px;
                    color: #d41f19;
                    margin-bottom: 5px;

                }
            }
        }

        >span {
            cursor: pointer;
            position: absolute;
            bottom: 0;
            right: -15px;
            font-size: 14px;
            color: #d41f19;
            position: absolute;
        }
    }
}

.txt1 {
    font-size: 18px;
    font-weight: bold;
    line-height: 40px;
}

.txt2 {
    font-size: 17px;
}

@media screen and (max-width:768px) {
    ::v-deep .el-drawer__header {
        background-color: #1068E7;
        margin-bottom: 0;
        color: #fff;
    }

    ::v-deep .el-tree-node__content {
        height: 30px;

        .el-tree-node__expand-icon {
            font-size: 18px;
        }
    }

    .tabList .classList .mulu ::v-deep .custom-tree-node {
        .typeImg {
            width: 15px;
            height: 15px;
            margin-right: 10px;
        }

        .txt2 {
            font-size: 16px;
        }
    }

    .tabList .classList .mulu .custom-tree-node {
        height: 30px;

        >span {
            height: 30px;
        }

        line-height: 30px;

        .txt1 {
            font-size: 15px;
            line-height: 30px;
        }
    }

    .main-con {
        width: 100vw;
        padding: 0 10px;

        .article {
            width: 100%;

            .all {
                width: 100%;
                overflow: visible;

                .top {

                    .other {
                        margin-top: 10px;
                        font-size: 12px;

                        .price {
                            font-size: 12px;

                            span {
                                font-size: 12px;
                            }

                            .num {
                                font-size: 13px;
                                margin-right: 15px;
                            }

                            .num1 {
                                font-size: 13px;
                            }
                        }

                        .cod {
                            font-size: 13px;

                            >span {
                                padding-right: 10px;
                                margin-left: 10px;
                            }
                        }
                    }
                }

                .bookImg {
                    width: 100%;
                }

                .top {
                    .title {
                        font-size: 20px;
                        padding: 10px 0;
                    }

                    .author {
                        font-size: 13px;

                        >span {
                            margin-right: 10px;
                        }
                    }

                    .tron {
                        font-size: 14px;
                        margin-top: 20px;
                        letter-spacing: 2px;
                        line-height: 20px;
                    }
                }
            }
        }

    }

    .mul {
        position: fixed;
        right: 10px;
        top: 130px;
        z-index: 222;

        img {
            width: 20px;
            height: 20px;

        }

        border-radius: 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 10px;
        color: #fff;
        padding: 10px;
        background-color: rgba($color: #000000, $alpha: .5);
    }

    .tabList {
        width: 100%;
        height: calc(100vh - 40px);
        margin-top: 0;

        .top {
            height: 101px;

            top: 0;
            padding: 0 10px 10px;

            .title {
                font-size: 20px;
                padding: 0 0 20px;
            }

            .author {
                font-size: 13px;

                >span {
                    margin-right: 10px;
                }
            }

            .other {
                margin-top: 10px;
                font-size: 12px;

                .price {
                    font-size: 12px;

                    span {
                        font-size: 12px;
                    }

                    .num {
                        font-size: 13px;
                        margin-right: 15px;
                    }

                    .num1 {
                        font-size: 13px;
                    }
                }

                .cod {
                    font-size: 13px;

                    >span {
                        padding-right: 10px;
                        margin-left: 10px;
                    }
                }
            }
        }

        .classify {
            padding: 0 10px;

            .ltab {
                height: 50px;
                padding-right: 0;

                >img {
                    width: 14px;
                    height: 14px;
                    margin-bottom: 15px;
                }

                .search {
                    width: 100% !important;
                    height: 40px;

                    input {
                        border-radius: 10px;
                        font-size: 14px;
                    }

                    img {
                        width: 14px;
                        height: 14px;
                        top: calc(50% - 7px);
                    }
                }

                .cover {
                    left: 0;
                }
            }

            .sousuo {
                .sstop {
                    >p {
                        font-size: 13px;
                    }

                    button {
                        font-size: 12px;
                    }
                }

                .ptabs {
                    height: calc(100vh - 250px);

                    >div {
                        font-size: 13px;
                    }
                }
            }

            .mulu {
                height: calc(100vh - 200px);

                >div {

                    font-size: 15px;
                }
            }

            .pinglun {
                .ptabs {
                    height: calc(100vh - 200px);

                }

                >p {
                    font-size: 13px;
                }

                .pushPl {
                    display: flex;
                    align-items: center;
                    height: 70px;

                    .callback {
                        font-size: 12px;
                    }

                    .el-input {
                        width: calc(100% - 60px);
                    }

                    .append {
                        height: 27px;
                        font-size: 12px;
                        width: 60px;
                        line-height: 27px;
                        position: static;
                    }
                }
            }

            .zhaichao {
                height: calc(100vh - 200px);
            }

            .wenku {
                height: calc(100vh - 200px);

                .articku {
                    margin-bottom: 15px;
                    padding-bottom: 10px;
                    font-size: 13px;

                    .type {
                        width: 13px;
                        margin-right: 10px;
                    }
                }
            }

            .tuijian {
                height: calc(100vh - 200px);

                .list_box {
                    margin-bottom: 10px;

                    >img {
                        width: 60px;
                        height: 60px;
                        border-radius: 10px;
                    }

                    .list_t {
                        margin-left: 10px;
                        font-size: 13px;
                        height: auto;

                        >span {
                            font-size: 13px;
                            margin-bottom: 5px;
                        }

                        >div {
                            >span {
                                font-size: 12px;
                            }

                            >div {
                                font-size: 12px;

                                img {
                                    width: 13px;
                                    height: 10px;
                                    margin-right: 5px;
                                }
                            }
                        }
                    }

                }
            }
        }
    }

}
</style>